package com.dhnsoft.boot.config;

import com.dhnsoft.boot.bean.Pig;
import com.dhnsoft.boot.bean.Sheep;
import com.dhnsoft.boot.bean.User;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author dhn
 * @version 1.0
 * @date 2023-08-17 17:06
 * @Desc
 */
@Configuration
@EnableConfigurationProperties(value = Sheep.class)
public class AppConfig {


    @Bean
    public Pig pig(){
        return new Pig();
    }

//    @Bean
//    public Sheep sheep(){
//        return new Sheep();
//    }

    @Scope //多实例bean
    @Bean
    public User user01(){
        User user = new User();
        user.setId(100L);
        user.setName("dhn");
        return user;
    }
}
